﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_SYS_LOGS
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtSYS_LOGS_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(this.txtOPERATORID.Text.Trim().Length==0)
			{
				strErr+="操作ID不能为空！\\n";	
			}
			if(this.txtOPERATORNAME.Text.Trim().Length==0)
			{
				strErr+="操作人姓名不能为空！\\n";	
			}
			if(this.txtOPERATORIP.Text.Trim().Length==0)
			{
				strErr+="操作IP不能为空！\\n";	
			}
			if(this.txtOPERATIONCODE.Text.Trim().Length==0)
			{
				strErr+="操作类型不能为空！\\n";	
			}
			if(this.txtOPERATEENTITY.Text.Trim().Length==0)
			{
				strErr+="操作表不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtOPERATETIME.Text))
			{
				strErr+="操作时间格式错误！\\n";	
			}
			if(this.txtCONTENT.Text.Trim().Length==0)
			{
				strErr+="内容不能为空！\\n";	
			}
			if(this.txtLOGINNAME.Text.Trim().Length==0)
			{
				strErr+="登录帐号不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtOPERATORAREAID.Text))
			{
				strErr+="操作区域ID格式错误！\\n";	
			}
			if(this.txtOP_AREA.Text.Trim().Length==0)
			{
				strErr+="操作区域不能为空！\\n";	
			}
			if(this.txtMODULENAME.Text.Trim().Length==0)
			{
				strErr+="模块名称不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string SYS_LOGS_ID=this.txtSYS_LOGS_ID.Text;
			string OPERATORID=this.txtOPERATORID.Text;
			string OPERATORNAME=this.txtOPERATORNAME.Text;
			string OPERATORIP=this.txtOPERATORIP.Text;
			string OPERATIONCODE=this.txtOPERATIONCODE.Text;
			string OPERATEENTITY=this.txtOPERATEENTITY.Text;
			DateTime OPERATETIME=DateTime.Parse(this.txtOPERATETIME.Text);
			string CONTENT=this.txtCONTENT.Text;
			string LOGINNAME=this.txtLOGINNAME.Text;
			decimal OPERATORAREAID=decimal.Parse(this.txtOPERATORAREAID.Text);
			string OP_AREA=this.txtOP_AREA.Text;
			string MODULENAME=this.txtMODULENAME.Text;
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_SYS_LOGS model=new MidSoft.Model.Model_T_SYS_LOGS();
			model.SYS_LOGS_ID=SYS_LOGS_ID;
			model.OPERATORID=OPERATORID;
			model.OPERATORNAME=OPERATORNAME;
			model.OPERATORIP=OPERATORIP;
			model.OPERATIONCODE=OPERATIONCODE;
			model.OPERATEENTITY=OPERATEENTITY;
			model.OPERATETIME=OPERATETIME;
			model.CONTENT=CONTENT;
			model.LOGINNAME=LOGINNAME;
			model.OPERATORAREAID=OPERATORAREAID;
			model.OP_AREA=OP_AREA;
			model.MODULENAME=MODULENAME;
			model.ID=ID;

			MidSoft.BLL.BLL_T_SYS_LOGS bll=new MidSoft.BLL.BLL_T_SYS_LOGS();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
